package dave.hibernate.lab;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.annotations.*;
import org.hibernate.tool.hbm2ddl.*;


@Entity
@Table (name="CUSTOMER", schema="test")
public class Customer{
	private Long id;
	private String firstName;
	private String lastName;
	private String address;
	private String tel;
	
	@Id
	@GeneratedValue
	@Column (name="ID")
	public Long getId(){
		return id;
	}
	public void setId(Long id){
		this.id = id;
	}
	@Column (name="FIRST_NAME")
	public String getFirstName(){
		return firstName;
	}
	
	@Column (name="FIRST_NAME")
	public void setFirstName(String firstName){
		this.firstName = firstName;
	}
	
	@Column (name="LAST_NAME")
	public String getLastName(){
		return lastName;
	}
	
	@Column (name="LAST_NAME")
	public void setLastName(String lastName){
		this.lastName = lastName;
	}
	
	@Column (name="ADDRESS")
	public String getAddress(){
		return address;
	}
	
	@Column (name="ADDRESS")
	public void setAddress(String address){
		this.address = address;
	}
	
	@Column (name="TELEPHONE")
	public String getTel(){
		return tel;
	}
	
	@Column (name="TELEPHONE")
	public void setTel(String tel){
		this.tel = tel;
	}
	
	public static void main(String[] args){
		//create a configuration object, reading from the hibernate.cf.xml file
		//Configuration config = new Configuration();
		Configuration config = new Configuration();
		//make sure hibernate aware of the User class
		config.addAnnotatedClass(Customer.class);
		//read and process hibernate.cfg.xml and JPA metadata
		config.configure();
		new SchemaExport(config).create(true,true);
	    
	}
}